Page({
  data: {
    // 评论图片
    reviewImages: [],
    // 服务图片
    serviceImages: [],
    // 用户头像
    avatarImage: []
  },

  onLoad() {
    // 页面加载时的初始化逻辑
  },

  // 评论图片上传变更
  handleReviewImagesChange(e) {
    const { files } = e.detail;
    this.setData({ reviewImages: files });
  },

  // 服务图片上传变更
  handleServiceImagesChange(e) {
    const { files } = e.detail;
    this.setData({ serviceImages: files });
  },

  // 用户头像上传变更
  handleAvatarChange(e) {
    const { files } = e.detail;
    this.setData({ avatarImage: files });
  },

  // 提交表单
  submitForm() {
    const { reviewImages, serviceImages, avatarImage } = this.data;

    // 检查是否有上传图片
    if (reviewImages.length === 0 && serviceImages.length === 0 && avatarImage.length === 0) {
      wx.showToast({
        title: '请至少上传一张图片',
        icon: 'none'
      });
      return;
    }

    // 模拟提交数据到服务器
    const submitData = {
      reviewImageUrls: reviewImages.map(img => img.url),
      serviceImageUrls: serviceImages.map(img => img.url),
      avatarUrl: avatarImage.length > 0 ? avatarImage[0].url : ''
    };

    wx.showToast({
      title: '提交成功',
      icon: 'success'
    });
  }
}) 